Public Class editTerminalnumbers
    Inherits System.Web.UI.Page
    'Protected WithEvents TheHeader1 As adm_header
    Public Msg, vid, uid As String
    Public aUserSession(13) As String
    ' Public oUtils As utils
    Public strUserTermHtml, strUserUniqTermHtml As String
    Public tidcct, i As Integer
    Public aTerminals As Array
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        'If aUserSession(cCOMPANY_ID) = "0" Then
        '    cid = safestring(Request("cid"))
        'Else
        '    cid = Application("CompanyID")
        'End If
        'If Request("vid").count > 0 Then
        '    vid = safestring(Request("vid"))
        '    uid = safestring(Request("uid"))
        'Else
        '    vid = aUserSession(cVIAKLIX_ID)
        '    uid = aUserSession(cUSER_ID)
        'End If
        'Msg = ""


        'TheHeader1.whichpage = 21
        'TheHeader1.pageid = "editterminalnumbers"
        'TheHeader1.helpaid = ""

        'aUserSession = TheHeader1.security()
        'TheHeader1.StartInterface(21)

        'If Request("s") = "1" Then
        '    TheHeader1.iMenuLevel = 7
        'ElseIf Request("s") = "2" Then
        '    TheHeader1.iMenuLevel = 9
        'End If

    End Sub
    Private Sub GetUserTeminal()
        'oTerminals = CreateObject("viaUserManagement.UserManagement")
        'oTerminals.DBConnectString = Application("DSN")
        'aTerminals = oTerminals.GetUserTerminals(uid, vid, CInt(cid))
        'tidcct = oTerminals.nTermCnt
        ''set oTerminals = nothing
        '        For i = 0 To UBound(aTerminals) - 1 Step 1
        '            aTids(i) = aTerminals(i, 2)
        '%>

        '			<form action="adm_EditTerminalNumbers.asp" method="post">
        '			<tr><td nowrap valign="top">
        '			<font face="arial" size="2"><%=aTerminals(i,0)%>
        '			</font>
        '			</td><td nowrap valign="top">
        '			<font face="arial" size="2"><%=aTerminals(i,3)%>
        '			</font>
        '			</td><td nowrap valign="top">
        '			<font face="arial" size="2"><%=aTerminals(i,1)%>
        '			<input type="hidden" name="pin" value="<%=aTerminals(i,1)%>" size="4" maxlength="4">

        '        	</font>
        '			</td>

        '			<td nowrap valign="top">
        '			<% if aTerminals(i,4) = "I" then
        '            printname = "Internet Order"
        '			elseif aTerminals(i,4) = "R" then
        '            printname = "Retail Order"
        '			elseif aTerminals(i,4) = "M" then
        '            printname = "MO/ TO"
        '			else
        '            printname = "Unknown"
        '			end if%>

        '			<font face="arial" size="2"><%=printname%>
        '			</font>
        '			</td><td nowrap>
        '			<select name="length">
        '			<option value="6">six characters</option>
        '			<option value="5">five characters</option>
        '			<option value="4">four characters</option>
        '			</select>
        '			</td><td nowrap>
        '			<select name="type">
        '			<option value="Numpin">numeric</option>
        '			<option value="alphnum">alphanumeric</option>
        '			</select>
        '			</td><td nowrap>
        '			<input type="hidden" name="s" value="<%=request("s")%>">
        '			<input type="hidden" name="owner_uid" value="<%=aTerminals(i,0)%>">
        '			<input type="hidden" name="terminalNumber" value="<%=aTerminals(i,2)%>">
        '			<input type="hidden" name="uid" value="<%=uid%>">
        '			<input type="hidden" name="cid" value="<%=cid%>">
        '			<input type="hidden" name="vid" value="<%=vid%>">
        '			<input type="submit" name="action" value="Change PIN">
        '			<input type="submit" name="action" value="Delete">
        '			</td>
        '			</tr>
        '			</form>

        '	<%
        '        Next

    End Sub
    Public Sub DetUserUniqTerm()
        '       If (aUserSession(cUSER_ID) <> uid) Then
        '           awnTerminals = oTerminals.GetUserUniqTerminals(uid, vid, CInt(cid), aUserSession(cUSER_ID))
        '       End If
        '       oTerminals = Nothing
        '       If IsArray(awnTerminals) And IsArray(aTids) Then
        '           oMerTids = CreateObject("Scripting.Dictionary")
        '           For i = 0 To UBound(awnTerminals) - 1 Step 1
        '               For a = 0 To UBound(aTids) - 1
        '                   If a <= UBound(aTids) - 1 And awnTerminals(i, 0) <> aTids(a) Then
        '                       If Not IsNull(oMerTids) Then
        '                           For Each Key In oMerTids
        '                               If awnTerminals(i, 0) = oMerTids(Key) Then
        '                                   Tid = oMerTids(Key)
        '                                   Exit For
        '                               End If
        '                           Next
        '                           If awnTerminals(i, 0) <> Tid Then
        '                               oMerTids.Add(awnTerminals(i, 1), awnTerminals(i, 0))
        '                           End If
        '                       Else
        '                           oMerTids.Add(awnTerminals(i, 1), awnTerminals(i, 0))
        '                       End If
        '                   End If
        '               Next
        '           Next

        '	if oMerTids.Count > 0 then %>
        '		  		   <p><table class="minorbox">

        '				<form action="adm_EditTerminalNumbers.asp" method="post">

        '				<tr><td colspan="2" class="header">Add New Terminal Association</td>
        '				</tr>
        '				<tr><td nowrap valign="top">

        '		 		<select name="termNumber">
        '					<% if oMerTids.Count > 0 then
        '								for Each Key in oMerTids%>
        '		  			 	  	   <option value="<%=oMerTids(Key)%>"><%=Key%></option>
        '		  			 	  <%
        '           Next
        '		  		 end if%>

        '	   		</select>
        '		   </td>
        '		    <td nowrap>
        '		     	<input type="hidden" name="uid" value="<%=uid%>">
        '		     	<input type="hidden" name="cid" value="<%=cid%>">
        '		     	<input type="hidden" name="vid" value="<%=vid%>">
        '		     	<input type="hidden" name="s" value="<%=request("s")%>">
        '		     	<input type="submit" name="action" value="Add">
        '	     	</td></tr>
        '			</form>
        '		</table>
        '	<%
        '       End If
        'else
        '       If IsArray(awnTerminals) Then
        '	%>
        '				<p><table class="minorbox">
        '				<form action="adm_EditTerminalNumbers.asp" method="post">
        '				<tr><td colspan="2" class="header">Add New Terminal Association</td>
        '				</tr>
        '				<tr><td nowrap valign="top">
        '		 		<select name="termNumber">
        '					<%for i = 0 to ubound(awnTerminals) - 1 step 1%>
        '		  			<option value="<%=awnTerminals(i,0)%>"><%=awnTerminals(i,1)%></option>
        '		  		<%next%>

        '	   		</select>
        '		   </td>
        '		    <td nowrap>
        '		     	<input type="hidden" name="uid" value="<%=uid%>">
        '		     	<input type="hidden" name="cid" value="<%=cid%>">
        '		     	<input type="hidden" name="vid" value="<%=vid%>">
        '		     	<input type="hidden" name="s" value="<%=request("s")%>">
        '		     	<input type="submit" name="action" value="Add">
        '	     	</td></tr>
        '			</form>
        '		</table>
        '	<%end if
       
    End Sub
    '   if request("action")="Change PIN" then
    '	terminalNumber=safestring(request("terminalNumber"))
    '      pin=safestring(request("pin"))
    '      suid=safestring(request("owner_uid"))
    '      if request("length").count > 0 then
    '      	pinlength = safestring(request("length"))
    '      	pintype = safestring(request("type"))
    '      end if
    '  	set oupd= createObject("viaUserManagement.UserManagement")
    '	oupd.DBConnectString=Application("DSN")
    '	oupd.pinlength= pinlength
    '	oupd.pintype= pintype
    '	oupd.SESSION_USER_ID=aUserSession(cUSER_ID)
    '	oupd.SESSION_VIAKLIX_ID=aUserSession(cVIAKLIX_ID)
    '	oupd.SESSION_COMPANY_ID=aUserSession(cCOMPANY_ID)
    '   '-----	BW 1/16/02 server ip, server time, and source ip auditing
    '	oupd.ServerIP = safestring(request.servervariables("LOCAL_ADDR"))
    '	oupd.ServerTime = safestring(now())
    '	oupd.SourceIP = safestring(request.servervariables("REMOTE_ADDR"))
    '   '-----	end server ip, server time, and source ip auditing
    '	newpin=oupd.UpdateTerminalAssoc(suid, vid, CInt(cid), terminalNumber, pin)
    '	if newpin<>"" then
    '		NotifyMsg = "PIN number: " & pin & " susccessfully changed to new PIN: " & newpin & "."
    '	else
    '		Msg = "PIN number update failed."
    '	end if

    'elseif request("action")="Add" then
    '	terminalNumber=safestring(request("termNumber"))
    '	if len(terminalNumber) > 22 or len(terminalNumber) < 7 then
    '			Msg = "Terminal Number cannot exceed 22 and must be more than 7 characters in length."
    '		else
    '		set oadd= createObject("viaUserManagement.UserManagement")
    '		oadd.DBConnectString=Application("DSN")
    '		oadd.SESSION_USER_ID=aUserSession(cUSER_ID)
    '		oadd.SESSION_VIAKLIX_ID=aUserSession(cVIAKLIX_ID)
    '		oadd.SESSION_COMPANY_ID=aUserSession(cCOMPANY_ID)
    '   '-----	BW 1/16/02 server ip, server time, and source ip auditing
    '		oadd.ServerIP = safestring(request.servervariables("LOCAL_ADDR"))
    '		oadd.ServerTime = safestring(now())
    '		oadd.SourceIP = safestring(request.servervariables("REMOTE_ADDR"))
    '   '-----	end server ip, server time, and source ip auditing
    '		oaddOk=oadd.AddUserTerminals(uid, vid, CInt(cid), terminalNumber)
    '		if oaddOk then
    '			NotifyMsg = "Terminal " & terminalNumber & " successfully added."
    '		else
    '   			msg = "Terminal addition failed."
    '		end if
    '  		end if
    'elseif request("action")="Delete" then
    '	terminalNumber=safestring(request("terminalNumber"))
    '	set odelete= createObject("viaUserManagement.UserManagement")
    '	odelete.DBConnectString=Application("DSN")
    '	odelete.SESSION_USER_ID=aUserSession(cUSER_ID)
    '	odelete.SESSION_VIAKLIX_ID=aUserSession(cVIAKLIX_ID)
    '	odelete.SESSION_COMPANY_ID=aUserSession(cCOMPANY_ID)
    '   '-----	BW 1/16/02 server ip, server time, and source ip auditing
    '	odelete.ServerIP = safestring(request.servervariables("LOCAL_ADDR"))
    '	odelete.ServerTime = safestring(now())
    '	odelete.SourceIP = safestring(request.servervariables("REMOTE_ADDR"))
    '   '-----	end server ip, server time, and source ip auditing
    '	odeleteOk=odelete.DeleteTerminalAssoc(request("owner_uid"), vid, CInt(cid), terminalNumber)
    '	if odeleteOk then
    '		NotifyMsg = "Terminal " & terminalNumber & " and  pin number " & request("pin") & " successfully deleted."
    '	else
    '		msg = "Terminal and pin number deletion failed."
    '	end if
    'end if


End Class
